const glob = require('glob');
const fs = require('fs');
const path = require('path');

glob('./views/**/*.js', (er, files) => {
    const app = files.filter(_ => _.indexOf('app'))[0];
    console.log(app);
    fs.writeFileSync(app, fs.readFileSync(app, 'utf-8').replace('.p="/"', '.p=__dirname + "/"'));
});

const html = './dist/views/index.html';
fs.writeFileSync(html,
    fs.readFileSync(html, 'utf-8')
        .replace(/href=\//g, 'href=./')
        .replace(/src=\//g, 'src=./'),
);
